package com.jinsilu.freight.helper;

import android.text.TextUtils;

/**
 * 银行卡、手机号中间*号隐藏
 *
 * @author yangyang
 * @time 2020-11-10 16:49
 */
public class ReplaceHelper {
    //给手机号加*
    public static String phoneFormat(String phone) {
        if (TextUtils.isEmpty(phone)) return "";
        return phone.substring(0, 3) + " **** " + phone.substring(phone.length() - 4);
    }

    //给银行卡号加*
    public static String bankCardFormat(String card) {
        if (TextUtils.isEmpty(card)) return "";
        return card.substring(0, 4) + " **** **** " + card.substring(card.length() - 4);
    }

    //给银行卡号加*
    public static String iDCardFormat(String card) {
        if (TextUtils.isEmpty(card)) return "";
        return card.substring(0, 6) + "  ****  " + card.substring(card.length() - 4);
    }
}
